﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameManager : MonoBehaviour {

    public enum InteractionMode
    {
        PC,
        VR,
    }

    private static GameManager _instance;
    public static GameManager Instance
    {
        get{
            return _instance;
        }
    }

    /*
     * 对于PC模式下,worldCamera就是携带camera组件的obj
     * 对于VR模式下,worldCamera就是OVRCameraRig
     */
    [HideInInspector]
    public GameObject worldCamera;

    public InteractionMode mode;

    [HideInInspector]
    public UIManager uiManager;

    public void Awake()
    {
        _instance = this;
        InitEnviroment();
    }


    void InitEnviroment()
    {
        switch(mode)
        {
            case InteractionMode.PC:
            {
                uiManager = new UIManager(this, new PCUIFrame());
                Object cameraObj = Resources.Load("Prefab/Camera/PCCamera");
                worldCamera = GameObject.Instantiate(cameraObj) as GameObject;
                break;
            }
            case InteractionMode.VR:
            {
                uiManager = new UIManager(this, new OVRUIFrame());
                Object cameraObj = Resources.Load("Prefab/Camera/OVRCameraRig");
                worldCamera = GameObject.Instantiate(cameraObj) as GameObject;
                break;
            }
        }
        uiManager.InitEnviroment();
    }


    void Start () {
		
	}
	
	void Update () {
		
	}
}
